import { createApp } from "vue";
import App from "./App.vue";
import router from "./router"; // 引入路由配置文件
import store from "@/store"; // 引入Vuex状态管理

import "@/assets/css/bootstrap.css";
import "@/assets/less/index.less";

import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";

// 导入辅助工具
import IconTools from "@/utils/icons.js";
import MessageTools from "@/utils/message.js";

import func from "@/assets/js/funcs";

const app = createApp(App);
app.use(router); // 使用路由配置
app.use(store); // 使用Vuex状态管理
app.use(ElementPlus); // 使用ElementPlus第三方组件

// 全局注册所有Element Plus图标组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}

// 将图标集合添加到全局属性中，便于在模板中访问
app.config.globalProperties.$icons = ElementPlusIconsVue;

// 添加全局辅助函数
app.config.globalProperties.$iconTools = IconTools;
app.config.globalProperties.$message = MessageTools;

app.config.globalProperties.$func = func;

app.mount("#app");
